Generic Routing Encapsulation (GRE) is a protocol for performing encapsulation of an arbitrary network layer protocol over another arbitrary network layer protocol. GRE is better known as a tunneling protocol since it allows a tunnel to be created using a certain protocol, which then hides the contents of another protocol carried within the tunnel.
In the most general application, a system has a packet that needs to be encapsulated and delivered to some destination. The packet, which is called ‘payload’, is first encapsulated in a GRE packet. The resulting GRE packet can then be encapsulated in some other protocol and then forwarded. This outer protocol is called the delivery protocol.
GRE is used, for example, when IP (internet protocol) packets need to be sent from one network to another, without being parsed or treated like IP packets by any intervening routers.